package com.vue.vuedemo.service.impl;

import com.vue.vuedemo.dao.PersonMapper;
import com.vue.vuedemo.pojo.Persons;
import com.vue.vuedemo.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("PersonService")
public class PersonServiceImpl implements PersonService {

   /*  @Resource默认按名称装配,当找不到名称匹配的bean再按类型装配.可以写在成员属性上,或写在setter方法上
    可以通过@Resource(name="beanName") 指定被注入的bean的名称, 要是未指定name属性, 默认使用成员属性的变量名,一般不用写name属性.
    @Resource(name="beanName")指定了name属性,按名称注入但没找到bean, 就不会再按类型装配了.*/
    @Resource
    private PersonMapper personmapper;

    @Override
    public List<Persons> findAll() {
        return personmapper.findAll();
    }

    @Override
    public Persons login(String username, String password) {
        return personmapper.login(username,password);
    }

    @Override
    public Persons idFindAll(Integer id) {
        return personmapper.idFindAll(id);
    }

    @Override
    public void add(Persons persons) {
        personmapper.add(persons);
    }

    @Override
    public void del(Integer id) {
        personmapper.del(id);
    }

    @Override
    public Persons usernameFindAll(String username) {
        return personmapper.usernameFindAll(username);
    }

    @Override
    public void updatePassword(String password,Integer id) {
        personmapper.updatePassword(password, id);
    }

    @Override
    public void tuanDuiAdd(Persons persons) {
        personmapper.tuanDuiAdd(persons);
    }

    @Override
    public Persons ManagerLogin(String username, String password) {
        return personmapper.ManagerLogin(username, password);
    }

    @Override
    public List<Persons> FirendPersonsFindAll(Integer fUserId) {
        return personmapper.FirendPersonsFindAll(fUserId);
    }
}
